<?php include( "templates/include/header.php" ); ?>
<table width="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td valign="middle" align="left">
				<form action="calendar.php" method="GET" style="text-align:left">
				  <b>Choisissez une cat&eacute;gorie:</b>
				  <select style="border:1px solid black;width:200px" name="event_category" onchange="submit();">
					  <option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "9") echo( 'selected="yes"');}?> value="9">Toutes</option>
  					<option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "0") echo( 'selected="yes"');}?> value="0" class="General">G&eacute;n&eacute;ral</option>
	  				<option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "1") echo( 'selected="yes"');}?> value="1" class="u67">U-6-7</option>
		  			<option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "2") echo( 'selected="yes"');}?> value="2" class="u9">U-9</option>
			  		<option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "3") echo( 'selected="yes"');}?> value="3" class="u11">U-11</option>
				  	<option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "4") echo( 'selected="yes"');}?> value="4" class="u13">U-13</option>
					  <option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "5") echo( 'selected="yes"');}?> value="5" class="u15">U-15</option>
					  <option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "6") echo( 'selected="yes"');}?> value="6" class="u18">U-18</option>
					  <option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "7") echo( 'selected="yes"');}?> value="7" class="seniorb">Senior B</option>
					  <option <?php if(isset($_GET['event_category'])){ if($_GET['event_category'] == "8") echo( 'selected="yes"');}?> value="8" class="seniora">Senior A</option>
					</select>
				</form>
			</td>
		</tr>
	</table>
<table align="center" width="90%"  cellpadding="1px" cellspacing="1px" class="Schedule">
  <thead>
	  <tr>
		  <th width="100px">Quand</th>
		  <th width="150px">O&uacute;</th>
		  <th width="100px">Cat&eacute;gorie</th>
		  <th>Description</th>
	  </tr>
  </thead>
  <tbody>
  <?php 
    if ( isset( $_GET['event_category'] ) ) {
      switch( $_GET['event_category'] ) {
        case 0:
          $data = Match::getByCategory( "General" );
          break;
        case 1:
          $data = Match::getByCategory( "u67" );
          break;
        case 2:
          $data = Match::getByCategory( "u9" );
          break;
        case 3:
          $data = Match::getByCategory( "u11" );
          break;
        case 4:
          $data = Match::getByCategory( "u13" );
          break;
        case 5:
          $data = Match::getByCategory( "u15" );
          break;
        case 6:
          $data = Match::getByCategory( "u18" );
          break;
        case 7:
          $data = Match::getByCategory( "seniorb" );
          break;
        case 8:
          $data = Match::getByCategory( "seniora" );
          break;
        default :
          $data = Match::getList();
          break;
      }
      $results['match'] = $data['results'];
    }
    foreach( $results['match'] as $match ) { ?>
  <tr class="<?php echo $match->category; ?>">
    <td width="150px">
      <?php echo( $match->eventDate ); ?>
    </td>
    <td width="150px">
      <?php echo( $match->location ); ?>
    </td>
    <td width="150px">
      <?php echo( $match->category ); ?>
    </td>
    <td valign="top" align="left">
      <?php if ( isset( $match->descript ) ) { echo( $match->descript ); } ?>
    </td>
  </tr>
  <?php } ?>
  </tbody>
</table>

<?php include( "templates/include/footer.php"); ?>
